<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace App\Controller;
use App\Request\AdminUserLoginRequest;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\DbConnection\Db;
use App\Utils\Log;
/**
 * @AutoController()
 */
class IndexController extends AbstractController
{
    public function index(AdminUserLoginRequest $request)

    {
        //过验证器
        $data = $request->validated();
        //加入日志
        Log::getInstance()->info('用户登录', $data);
        //看看连数据库
        $row = Db::table('ecs_goods')->first(); // sql 会自动加上 limit 1
        print_r($row);
        return [
            'method' => $row->goods_name,
            'message' => "Hello1 2.",
        ];
    }

    public function getData()
    {
        return $this->response->json(['code' => 0, 'msg' => 'success', 'data' => ['a' => 1]]);
    }
}
